package com.eedi.framework.oauth2.dal.dataobject;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.eedi.framework.common.enums.UserTypeEnum;
import com.eedi.framework.org.core.db.OrgInfoBaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

/**
 * OAuth2 授权码 DO
 *
 * @author 永聚长青源码
 */
@TableName(value = "org_oauth2_code", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
public class OrgOAuth2CodeDO extends OrgInfoBaseDO {


    /**
     * 业务id
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String orgOauth2CodeId;

    /**
     * 授权码
     */
    private String code;
    /**
     * 用户编号
     */
    private String userId;
    /**
     * 用户类型
     *
     * 枚举 {@link UserTypeEnum}
     */
    private UserTypeEnum userType;
    /**
     * 客户端编号
     *
     * 关联 {@link OrgOAuth2ClientDO#getOrgOauth2ClientId()} ()} ()} ()}
     */
    private String orgOauth2ClientId;
    /**
     * 授权范围
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> scopes;
    /**
     * 重定向地址
     */
    private String redirectUri;
    /**
     * 状态
     */
    private String state;
    /**
     * 过期时间
     */
    private LocalDateTime expiresTime;

}
